cmake_minimum_required(VERSION 3.0)
project(Utils)
set(CMAKE_BUILD_TYPE "Release")

include_directories(.)
set(CMAKE_CXX_STANDARD 11)

add_library(utils SHARED Utils.cpp)

option(BUILD_TEST "build test executables" OFF)
if(BUILD_TEST)
add_subdirectory(test)
endif()

cmake_policy(SET CMP0062 OLD)

# Add to module path, so we can find our cmake modules
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
# set required include files and libs
set(REQUIRED_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/lyxutils)
set(REQUIRED_LIBRARIES utils)
#The following will do install
include(install_package)
install_package(
  PKG_NAME Utils
  LIB_NAME utils
  VERSION 0.1
  DESCRIPTION "some convenient utilities"
  INSTALL_HEADERS Utils.h
  #INSTALL_HEADER_DIRS test
  DESTINATION ${CMAKE_INSTALL_PREFIX}/include/lyxutils
  INCLUDE_DIRS ${REQUIRED_INCLUDE_DIRS}
  LINK_LIBS ${REQUIRED_LIBRARIES}
  )
#The following can make `sudo make uninstall` work
include(${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in)
add_custom_target(uninstall
    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
